What you've learned today

  • You can define graphs formally as G=(V,E) and understand core terminology including vertices, edges, degree, in-degree, out-degree, and the distinctions between undirected/directed, weighted/unweighted, and simple/multigraph models.
  • You can encode graphs using three standard representations—edge list, adjacency list, and adjacency matrix—and understand their space/time trade-offs: O(m) vs O(n+m) vs O(n²) for storage, and varying costs for adjacency tests and neighbor iteration.
  • You can convert graphs between representations, maintaining critical properties like symmetry for undirected graphs, handling weights and directions correctly, and avoiding common pitfalls with indexing, loops, and parallel edges.
  • You can implement basic operations safely: building graphs from edge lists, adding/removing edges with proper symmetry, testing adjacency, listing neighbors, computing degrees, and choosing the right representation based on graph density and operation requirements.